﻿using SharpDepend.Classes;
using SharpDepend.Shared;
using SharpDepend.WindowsDesktop;
using SharpDepend.WindowsDesktop.Renderer;
using System.Linq;

namespace SharpDepend.WPF
{
    public static class Manager
    {
        /// <summary>
        /// Initialize Windows Desktop implementation of SharpDepend classes.
        /// </summary>
        public static void Init()
        {
            Init(false);
        }

        /// <summary>
        /// Initialize Windows Desktop implementation of SharpDepend classes.
        /// </summary>
        /// <param name="usesInWindowsForms">Set true if SharpDepend runs in WindowsForms instead of WPF.</param>
        public static void Init(bool usesInWindowsForms)
        {
            SharpDepend.Manager.Registrate(
                new ClientManager(),
                new ServerManager(),
                new MulticastManager(),
                new ThreadManager(),
                new AESSecurityManager(),
                new GUITimerManager(usesInWindowsForms),
                new FileManager(),
                new MultiTouchManager(),
                new DialogManager(),
                new GraphicsDisplayManager(),
                new KeyboardManager(),
                null,
                new StopwatchManager(),
                new EnviromentStatisticsManager());

            SharpDepend.Manager.GraphicsDisplayManager.AddDevice(new GraphicDevice(typeof(SoftwareRenderer), "Software"));
            SharpDepend.Manager.GraphicsDisplayManager.AddDevice(new GraphicDevice(typeof(OpenGLRenderer), "OpenGL"));
            //SharpDepend.Manager.GraphicsDisplayManager.AddDevice(new GraphicDevice(typeof(Direct2DRenderer), "Direct2D"));
            
            // Set first graphics device as default.
            SharpDepend.Manager.GraphicsDisplayManager.SetGraphicsDevice(
                SharpDepend.Manager.GraphicsDisplayManager.AvailableDevices.ElementAt(1));
        }
    }
}
